#include "stdafx.h"
#include "IDevice.h"


IDevice::IDevice():m_RenderType(ERENDER_TYPE::DIRECTX), m_pDevice(NULL)
{

}
IDevice::~IDevice()
{

}
bool	IDevice::InitDevice(ERENDER_TYPE _RenderType, void* &_pDevice, HWND _hwnd, bool _IsWnd, int _Width,
						 int _Height, bool _IsVSync, bool _IsColor16, int _btMSAA,bool _IsMultThread)
{
	switch(_RenderType)
	{
	case DIRECTX:
		{
			m_pDevice =  new DXDevice();
			DXDevice* t_DXDevce = (DXDevice*)m_pDevice; 
			return t_DXDevce->InitDXDevice(/*_pDevice,*/ _hwnd, _IsWnd=true, _Width,
				_Height, _IsVSync, _IsColor16, _btMSAA, _IsMultThread);
		}
		break;
	}
}
void*	IDevice::GetDevice()
{
	switch(m_RenderType)
	{
	case DIRECTX:
		{
			DXDevice* t_DXDevce = (DXDevice*)m_pDevice; 
			return t_DXDevce->GetDXDevice();
		}
		break;
	}
}
bool	IDevice::ReleaseDevice()
{
	switch(m_RenderType)
	{
	case DIRECTX:
		{
			DXDevice* t_DXDevce = (DXDevice*)m_pDevice;
			return t_DXDevce->ReleaseDXDevice();
		}
		break;
	}		
}


Texture*	IDevice::LoadTexture(wchar_t* _TextureName)
{
	switch(m_RenderType)
	{
	case DIRECTX:
		{
			DXDevice* t_DXDevce = (DXDevice*)m_pDevice;
			return t_DXDevce->LoadTexture(_TextureName);
		}
		break;
	}		
}

bool	IDevice::DrawTexture(float _X, float _Y, float _Width, float _Height, Texture* _Texture)
{
	switch(m_RenderType)
	{
	case DIRECTX:
		{
			DXDevice* t_DXDevce = (DXDevice*)m_pDevice;
			return t_DXDevce->DrawTexture(_X, _Y, _Width, _Height, _Texture);
		}
		break;
	}		
}

void*	IDevice::LoadFont(wchar_t* _FontName, int _FontSize)
{
	switch(m_RenderType)
	{
	case DIRECTX:
		{
			DXDevice* t_DXDevce = (DXDevice*)m_pDevice;
			return t_DXDevce->LoadFont(_FontName, _FontSize);
		}
		break;
	}		
}

